<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>noise</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="nlfilt2.html" title="nlfilt2" />
    <link rel="next" href="noteoff.html" title="noteoff" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">noise</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="nlfilt2.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="noteoff.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="noise"></a>
      <div class="titlepage"></div>
      <a id="IndexNoise" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">noise</span>
        </h2>
        <p>noise — 
      A white noise generator with an IIR lowpass filter.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp127318912"></a>
        <h2>Description</h2>
        <p>
      A white noise generator with an IIR lowpass filter.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127320272"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>noise</strong></span> xamp, kbeta</pre>
      </div>
      <div class="refsect1">
        <a id="idp127392672"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>xamp</em></span> -- amplitude of final output
    </p>
        <p>
      <span class="emphasis"><em>kbeta</em></span> -- beta of the lowpass filter. Should
      be in the range of -1 to 1, exclusive of the end-points.
    </p>
        <p>
      The filter equation is:
      </p>
        <div class="mediaobject">
          <img src="images/noise-filter.png" alt="[Filter equation for filter in noise opcode.]" />
        </div>
        <p>

      where <span class="emphasis"><em>x<sub>n</sub></em></span> is the original white noise and <span class="emphasis"><em>y<sub>n</sub></em></span> is lowpass filtered noise. The higher β is, the lower the filter's cut-off frequency. The cutoff frequency is roughly sr * ((1-kbeta)/2).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127400336"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the noise opcode. It uses the file <a class="ulink" href="examples/noise.csd" target="_top"><em class="citetitle">noise.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp127402416"></a>
          <p class="title">
            <strong>Example 540. Example of the noise opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac  <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o noise.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

kbeta <span class="opc">line</span> <span class="op">-</span>0.9999, p3, 0.9999	<span class="comment">;change beta value between -1 to 1</span>
asig  <span class="opc">noise</span> .3, kbeta
asig  <span class="opc">clip</span> asig, 2, .9	<span class="comment">;clip signal</span>
      <span class="opc">outs</span> asig, asig

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 10

<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
        <p>
      Here is an example of the noise opcode controlling the kbeta parameter with a GUI interface. It uses the file <a class="ulink" href="examples/noise-2.csd" target="_top"><em class="citetitle">noise-2.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp127407936"></a>
          <p class="title">
            <strong>Example 541. Example of the noise opcode controlled with a GUI.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac     <span class="comment">;  -iadc     -d     ;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o noise.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

<span class="opc">FLpanel</span> "noise", 200, 50, <span class="op">-</span>1 , <span class="op">-</span>1
    gkbeta, gislider1 <span class="opc">FLslider</span> "kbeta", <span class="op">-</span>1, 1, 0, 5, <span class="op">-</span>1, 180, 20, 10, 10
<span class="opc">FLpanelEnd</span>
<span class="opc">FLrun</span>

<span class="oblock">instr</span> 1
  iamp <span class="op">=</span> <span class="ohdr">0dbfs</span> <span class="op">/</span> 4  <span class="comment">; Peaks 12 dB below 0dbfs</span>
  <span class="opc">print</span> iamp

  a1 <span class="opc">noise</span> iamp, gkbeta*0.9999
  <span class="opc">printk2</span> gkbeta*0.9999
  <span class="opc">outs</span> a1,a1
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Play Instrument #1 for one minute.</span>
<span class="stamnt">i</span> 1 0 60
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127409808"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>University of Bath, Codemist. Ltd.</td>
          </tr>
          <tr>
            <td>Bath, UK</td>
          </tr>
          <tr>
            <td>December 2000</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 4.10</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="nlfilt2.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="noteoff.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">nlfilt2 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> noteoff</td>
        </tr>
      </table>
    </div>
  </body>
</html>
